﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class BarCtr : MonoBehaviour {

    public Gradient gradientColor;
    public float sizeRadio = 1;
    public float sampleValue;

    Renderer render;
    Vector3 startSize;

	// Use this for initialization
	void Start () {
        startSize = transform.localScale;
        render = GetComponentInChildren<Renderer>();
    }
	
	// Update is called once per frame
	void Update ()
    {
        //transform.localScale = new Vector3(transform.localScale.x, transform.localScale.y, startSize.z * sampleValue * sizeRadio);
        transform.localScale = startSize * sampleValue * sizeRadio;
        render.material.color = gradientColor.Evaluate(sampleValue * .6f);

    }
}
